<!DOCTYPE html>
<html>
<head>
<title></title> <@h.head />
<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>
</head>
<body>
	<form action="${path}/sysrole/save" id="fm" method="post" class="definewidth m20">
		<div style="text-align: center;" id="errorMsg"></div>
		<table class="table table-bordered table-hover definewidth m10">
			<input type="hidden" id="roleId" value="${(roleId)!''}" name="id">
			<tr>
				<td width="10%" class="tableleft">角色名 <span class="required">*</span></td>
				<td><input type="text" name="name" datatype="s1-50" calss="disabled"
					nullmsg="请输入角色名称！" errormsg="角色名少于50个字符！" /> <span
					class="Validform_checktip">角色名少于50个字符</span></td>
			</tr>
			<tr>
				<td class="tableleft">描述</td>
				<td><input type="text" name="remark" value="${(role.remark)!''}"/></td>
			</tr>
			<tr>
				<td class="tableleft"></td>
				<td>
					<button type="submit" class="btn btn-primary" type="button">保存</button>
					&nbsp;&nbsp;
					<button type="button" class="btn" name="backid"
						id="backid">返回列表</button>
				</td>
			</tr>
		</table>
	</form>
	<@h.foot />
<script type="text/javascript">
	$(function() {
		$('#backid').click(function() {
			window.location.href = "${path}/sysrole/list";
		});
		var roleVal = $("#roleId").val();
		if (roleVal != null && roleVal != 0) {
			var url = "${path}/sysrole/getById/" + roleVal;
			$.get(url, function(data) {
				var data = eval('(' + data + ')');
				$("#fm").jsonData(data.data);
				$(".disabled").attr("readOnly", "readOnly");
			});
		};
	});
	var callback = function(data) {
		if (data.status == "200") {
			window.location.href = "${path}/sysrole/list";
		} else {
			$("#errorMsg").html(data.msg).show();
		}
	}
	$("#fm").validFrom(callback);
</script>
</body>
</html>